// 用来拦截数组的方法
	function myArray() {
	}
	myArray.prototype.__proto__ = Array.prototype;

	// push方法的拦截
	myArray.prototype.push = function() {
		let args = Array.from(this.push.arguments);
		let len = this.length;	// 备份当前数组的大小

		[].push.apply(this, args);

		this.addResponse(this, len, args);
	}

	// unshift的拦截
	myArray.prototype.unshift = function() {
		let args = Array.from(this.push.arguments);
		let len = this.length;	// 备份当前数组的大小

		[].unshift.apply(this, args);

		this.addResponse(this, len, args);
	}

	// 为动态的元素提供转换为响应式的函数
	myArray.prototype.addResponse = function(obj, len, args) {
		for(let i = 0; i < args.length; i++) {
			if(typeof args[i] === 'object') {
				response(args[i])
			} else {
				defineResponse(obj, len+i, args);
			}
		}
	}

	// 执行响应式操作
	function response(obj) {
		let keys = Object.keys(obj);

		for(let i = 0; i < keys.length; i++) {
			if(typeof(obj[keys[i]]) === 'object' ) {
				if(Array.isArray(obj[keys[i]])) {	// 如果使数组，则修改原型链
					obj[keys[i]].__proto__ = myArray.prototype;
				}
				response(obj[keys[i]]);
			} else {
				defineResponse(obj, keys[i], obj[keys[i]]);
			}
		}

	}

	// 响应式原理
	function defineResponse(obj, key, value, enumerable) {
		Object.defineProperty(obj, key, {
			enumerable: enumerable == undefined ? true : !!enumerable,
			get: ()=>{
				return `获取到了${key}的值：${value}`;
			},
			set: (newValue)=>{
				value = newValue;
				console.log(`设置${key}的值为${value}`);
			}
		})
	}